/**
 * 打开地图等级选择器
 */
function openLevelSelector() {
    $("body").append($("<div id='levelSector' class='panel'>" +
        "    <div><a class='verticalCenter'>下载等级选择</a><a class='verticalCenter closeBtn_com' onclick='closeLevelSelector()'>×</a></div>" +
        "    <div>" +
        "        <div>最小等级：</div>" +
        "        <input type='range' step='1' min='0' max='17' value='0' class='minSelector' onchange='valueChange(true)'>" +
        "        <div>0</div>" +
        "    </div>" +
        "    <div>" +
        "        <div>最大等级：</div>" +
        "        <input type='range' step='1' min='0' max='17' value='17' class='maxSelector' onchange='valueChange(false)'>" +
        "        <div>17</div>" +
        "    </div>" +
        "    <div><div><button class='positive verticalCenter'>确定</button></div><div><button class='negative verticalCenter' onclick='closeLevelSelector()'>取消</button></div></div>" +
        "</div>"))


}

/**
 * 关闭地图等级选择器
 */
function closeLevelSelector() {
    $("#levelSector").remove();
}

function valueChange(index) {
    let valueMin=$("input.minSelector").val();
    let valueMax=$("input.maxSelector").val();
    if (index) {
        $("input.minSelector + div").text(valueMin);
        if(Number(valueMin)>Number(valueMax)){
            $("input.maxSelector").val(valueMin);
            $("input.maxSelector + div").text(valueMin);
        }
    } else {
        $("input.maxSelector + div").text(valueMax);
        if(Number(valueMin)>Number(valueMax)){
            $("input.minSelector").val(valueMax);
            $("input.minSelector + div").text(valueMax);
        }
    }
}